package cn.gxa.j229.bug.finance.controller.borrowing;

import cn.gxa.j229.bug.finance.service.borrowing.PullMeanService;
import cn.gxa.j229.bug.finance.utils.JsonResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/pullMean")
public class PullMeanController {

    @Resource
    PullMeanService pullMeanService;

    @PostMapping("/findAllGgrade")
    @ResponseBody
    public Map findAllFromGrade(){

        List allGrade = pullMeanService.findAllFromTbGrade();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allGrade);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllRepayment")
    @ResponseBody
    public Map findAllFromTbRepayment(){
        List allRepayment = pullMeanService.findAllFromTbRepayment();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allRepayment);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllType")
    @ResponseBody
    public Map findAllFromTbType(){
        List allType = pullMeanService.findAllFromTbType();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allType);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllPurpose")
    @ResponseBody
    public Map findAllFromTbPurpose(){
        List<Map<String, Object>> allFromTbPurpose = pullMeanService.findAllFromTbPurpose();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allFromTbPurpose);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }


    @PostMapping("/findAllGuarantee")
    @ResponseBody
    public Map findAllFromTbGuarantee(){
        List<Map<String, Object>> allFromTbGuarantee = pullMeanService.findAllFromTbGuarantee();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allFromTbGuarantee);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllAddMoney")
    @ResponseBody
    public Map findAllFromTbAddMoney(){
        List<Map<String, Object>> allFromTbAddMoney = pullMeanService.findAllFromTbAddMoney();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allFromTbAddMoney);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllLoanState")
    @ResponseBody
    public Map findAllFromLoanState(){
        List<Map<String, Object>> allLoanState = pullMeanService.findAllFromLoanState();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allLoanState);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllPledge")
    @ResponseBody
    public Map findAllFromPledge(){

        List allPledge = pullMeanService.findAllFromTbPledge();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allPledge);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllCategory")
    @ResponseBody
    public Map findAllFromCategory(){

        List allCategory = pullMeanService.findAllFromCategory();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allCategory);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }

    @PostMapping("/findAllTbState")
    @ResponseBody
    public Map findAllFromTbState(){

        List allstate = pullMeanService.findAllFromTbState();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(allstate);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }
    @PostMapping("/findAllTbLabel")
    @ResponseBody
    public Map findAllFromTbLabel(){

        List alllabel = pullMeanService.findAllFromTbLabel();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(alllabel);
        jsonResult.setCode("200");
        jsonResult.setMsg("成功");
        return jsonResult.getValues();
    }



}
